package com.linux.huhx.thread3.lock_1;

/**
 * @Author: huhx
 * @Date: 2017-10-30 下午 5:36
 */
public class RunFair {
    public static void main(String[] args) throws InterruptedException {
        final MyService myService = new MyService(true);
        Runnable runnable = () -> {
            System.out.println("name " + Thread.currentThread().getName() + " run");
            myService.serviceMethod();
        };
        Thread[] threadArray = new Thread[10];
        for (int i = 0; i < 10; i++) {
            threadArray[i] = new Thread(runnable);
        }
        for (int i = 0; i < 10; i++) {
            threadArray[i].start();
        }
    }
}
